package com.huawei.appgallery.forum.message.card;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;
import com.huawei.appgallery.forum.base.card.ForumCard;
import com.huawei.appgallery.forum.base.card.bean.CommentReference;
import com.huawei.appgallery.forum.base.card.bean.PostTime;
import com.huawei.appgallery.forum.base.card.bean.User;
import com.huawei.appgallery.forum.message.bean.ForumRemindLikeCardBean;
import com.huawei.appgallery.forum.message.widget.CommentReferenceUserView;
import com.huawei.appgallery.forum.message.widget.CommentReferenceView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import o.azb;
import o.bse;
import o.btc;
import o.bvj.a;
import o.bvj.b;
import o.bvj.c;
import o.bvj.d;
import o.bvj.j;
import o.cgz;
import o.ContentManager;

public class ForumRemindLikeCard extends ForumCard {
    private View ˊ;
    private CommentReferenceView ˋ;
    private TextView ˎ;
    private CommentReferenceUserView ˏ;
    private View ॱ;

    public ForumRemindLikeCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ʽ(view);
        this.ˏ = (CommentReferenceUserView) view.findViewById(b.ᐨ);
        this.ˎ = (TextView) view.findViewById(b.ॱʽ);
        this.ˋ = (CommentReferenceView) view.findViewById(b.ॱͺ);
        this.ˊ = view.findViewById(b.ͺ);
        this.ॱ = view.findViewById(b.ॱ);
        this.ॱ.setVisibility(8);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof ForumRemindLikeCardBean) {
            ˏ((ForumRemindLikeCardBean) cardBean);
            this.ˊ.setVisibility(ˊᐝ() ? 0 : 8);
        }
    }

    private void ˏ(ForumRemindLikeCardBean forumRemindLikeCardBean) {
        if (forumRemindLikeCardBean.ˋॱ()) {
            this.ॱ.setVisibility(0);
        } else {
            this.ॱ.setVisibility(8);
        }
        this.ˏ.setDomainId(forumRemindLikeCardBean.ॱ());
        User ˊ = forumRemindLikeCardBean.ˊ();
        if (ˊ != null) {
            this.ˎ.setCompoundDrawables(null, null, null, null);
            this.ˏ.setUser(ˊ);
            if (ˊ.ॱ() == null) {
                ˎ();
                this.ˎ.setText(bse.ˏ.ॱ(400012).ˎ());
                return;
            }
            switch (forumRemindLikeCardBean.ॱˊ()) {
                case 0:
                    this.ˎ.setText(j.ˊᐝ);
                    break;
                case 1:
                    this.ˎ.setText(j.ˋᐝ);
                    break;
                case 2:
                    this.ˎ.setText(j.ˊˊ);
                    break;
                case 3:
                    this.ˎ.setText(j.ˊˋ);
                    break;
                default:
                    this.ˎ.setText("");
                    break;
            }
            PostTime ᐝ = forumRemindLikeCardBean.ᐝ();
            if (ᐝ != null) {
                this.ˏ.setSectionName(btc.ˏ(this.ʼॱ, ᐝ));
            }
        } else {
            this.ˏ.setUser(null);
            this.ˏ.setSectionName(null);
            ˎ();
            this.ˎ.setText(bse.ˏ.ॱ(400012).ˎ());
        }
        CommentReference ʽ = forumRemindLikeCardBean.ʽ();
        if (ʽ != null) {
            ʽ.ˊ(ˋ(forumRemindLikeCardBean));
        }
        this.ˋ.setPostTitleWidth(((azb.ॱ(this.ʼॱ) - this.ʼॱ.getResources().getDimensionPixelSize(d.ˊॱ)) - this.ʼॱ.getResources().getDimensionPixelSize(d.ʼ)) - this.ʼॱ.getResources().getDimensionPixelSize(d.ʽ));
        this.ˋ.setReference(ʽ);
        this.ˋ.setDomainId(forumRemindLikeCardBean.ॱ());
    }

    private void ˎ() {
        Drawable drawable = this.ʼॱ.getResources().getDrawable(c.ॱˋ);
        drawable.setBounds(0, 0, 64, 64);
        this.ˎ.setTextColor(ContentManager.getInstant().getContext().getResources().getColor(a.ʻ));
        this.ˎ.setCompoundDrawables(drawable, null, null, null);
        this.ˎ.setCompoundDrawablePadding(8);
    }

    private int ˋ(ForumRemindLikeCardBean forumRemindLikeCardBean) {
        switch (forumRemindLikeCardBean.ॱˊ()) {
            case 0:
                return 1;
            case 1:
                return 2;
            case 2:
                return 4;
            case 3:
                return 5;
            default:
                return 0;
        }
    }
}
